<template>
	<el-table-column :width="row.width" :align="row.align || 'center'" :label="row.label || ''" :prop="row.prop"
		:type="row.type || ''" :fixed="row.fixed">
		<template slot-scope="scope">
			<template v-for="(b,k) in row.handles">
				<el-button v-if="showButton(b,scope.row)" :key="k" :type="b.type || 'primary'" @click="Fn(b.method,scope.row)"
					:size="b.size || 'mini'" :round="b.round" :plain="b.plain" :circle="b.circle" :icon="b.icon">{{b.text}}</el-button>
			</template>
		</template>
	</el-table-column>
</template>

<script>
	export default {
		props: {
			row: Object,
		},
		inject: ["vm"],
		methods: {
			// 方法调用
			Fn(method, row) {
				try {
					this.vm[method](row);
				} catch (e) {
					console.log(11313, e);
					this.openMessage(`未定义方法 ${method}`, "warning");
				}
			},
			showButton(b, arg) {
				if (b.show) return b.show(arg, this.vm);
				return true;
			},
		},
	};
</script>

<style>
</style>